Accessibility

Analyzing The J2EE Application

Now that you understand some of the basic background information, I can explain the J2EE application that I started with. This application is a simple J2EE implementation for a travel-oriented website, a fictional company named Axion Adventures. It is a basic J2EE application that was initially used (JRun4 users might recognize it) to demonstrate J2EE capabilities. I chose it because it was simple enough to see how the different elements functioned and used servlets, EJB, and JSP.

Using this application, the user (who must login first), can view a list of possible vacation packages, details of each, and finally reserve one of the vacations.

Figure 1. A screenshot for the first page in the application.

Full-size image

Figure 1. A screenshot for the first page in the application.

This application also has a separate sub-application, which is a web services interface and client that allows Axion Adventures partners (in this example, the partner is a fictional company called TravelNet) to list vacations and vacation details and place reservations for trips. Because this is all done through a web services interface, the application actually interacts directly with the core Axion Adventures website. This means that modifying anything on the main site (such changing a price or preventing a user from booking a vacation because it’s full, and so forth) show up on your partners’ sites in real time.

The J2EE Architecture. A few basic J2EE elements comprise the site:

  • A logon servlet that produces the login form to process user logins.
  • A JavaBeans component (called TripBean) that retrieves a list of trips to display to users.
  • A few JSP templates to display trip information and login UI that call the database, and components (both JavaBeans and EJB components) to retrieve the appropriate information.
  • A session EJB component (called Reservation) that handles reservations (and acts as a façade to call on other beans).
  • A session EJB component (called CreditCard) that processes credit card transactions.
  • An entity EJB component (called Order) that interacts with the database for orders.
  • A web services interface that displays both trip information and handles reservations.
  • A web services client that executes essentially what the JSP templates do in the main site—displays all trips, displays the trip details, and takes information to process reservations.

This is a good example of a J2EE application because for the most part, session beans handle the business, an entity bean interacts with the database, and a JavaBeans object handles application data (the trips in this case). All of the JSP pages display the UI directly while interacting with these logic and data components directly.

Additionally, the app uses a number of J2EE patterns. The most notable of these is the session façade pattern, where the Reservation bean interacts with both the CreditCard and Order beans. The JSP page simply needs to call on Reservation and not on all of the beans. Finally, the logon servlet handles logging in users. While this isn’t entirely a controller model (if it were, you would call all pages through a single servlet, the servlet would then include or forward to the appropriate JSP template or another servlet), this function is a typical process that a controller servlet handles. Figure 2 is a visual diagram that represents the initial J2EE application structure.

Figure 2. The initial J2EE application structure.

Figure 2. The initial J2EE application structure.

Submit feedback on our tutorials, articles, and sample applications.